#coding: utf-8
import threading
from time import sleep, ctime

loops = [4,2]

def  loop(nloop, nsec):
	print 'loop', nloop, 'start at:', ctime()
	print 'loop %d 挂起%d秒' % (nloop, nsec)
	sleep(nsec)
	print 'loop', nloop, 'done at:', ctime()

def main():
	print 'main thread start!'
	threads = []  #线程列表
	nloops = range(len(loops))

	for i in nloops:
		t = threading.Thread(target=loop, args=(i, loops[i]))
		threads.append(t)

	for i in nloops:
		threads[i].start()

	for i in nloops:
		threads[i].join()  #等待线程结束

	print 'all done at:', ctime()

if __name__ == '__main__':
	main()

a=[1,2,3,4,5,6,7,8,9,10]
for i in range(0,len(a),3):
    b=a[i:i+3]
    print b
    print i
